home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
c
/
ww_tv.exe
/
VIEWS.H
< prev
next >
Wrap
C/C++ Source or Header
|
1992-08-13
|
26KB
|
975 lines
/* ------------------------------------------------------------------------*/
/* */
/* VIEWS.H */
/* */
/* Copyright (c) Borland International 1991 */
/* All Rights Reserved. */
/* */
/* defines the classes TView, TFrame, TScrollBar, TScroller, */
/* TListViewer, TGroup, and TWindow */
/* */
/* ------------------------------------------------------------------------*/
// Primatech Modification History:
//
// 11-25-91 JLS Changed change() to have the shift state passed in
//
#if !defined( __COMMAND_CODES )
#define __COMMAND_CODES
const ushort
// Standard command codes
cmValid = 0,
cmQuit = 1,
cmError = 2,
cmMenu = 3,
cmClose = 4,
cmZoom = 5,
cmResize = 6,
cmNext = 7,
cmPrev = 8,
cmHelp = 9,
// TDialog standard commands
cmOK = 10,
cmCancel = 11,
cmYes = 12,
cmNo = 13,
cmDefault = 14,
// TView State masks
sfVisible = 0x001,
sfCursorVis = 0x002,
sfCursorIns = 0x004,
sfShadow = 0x008,
sfActive = 0x010,
sfSelected = 0x020,
sfFocused = 0x040,
sfDragging = 0x080,
sfDisabled = 0x100,
sfModal = 0x200,
sfDefault = 0x400,
sfExposed = 0x800,
// TView Option masks
ofSelectable = 0x001,
ofTopSelect = 0x002,
ofFirstClick = 0x004,
ofFramed = 0x008,
ofPreProcess = 0x010,
ofPostProcess = 0x020,
ofBuffered = 0x040,
ofTileable = 0x080,
ofCenterX = 0x100,
ofCenterY = 0x200,
ofCentered = 0x300,
// TView GrowMode masks
gfGrowLoX = 0x01,
gfGrowLoY = 0x02,
gfGrowHiX = 0x04,
gfGrowHiY = 0x08,
gfGrowAll = 0x0f,
gfGrowRel = 0x10,
// TView DragMode masks
dmDragMove = 0x01,
dmDragGrow = 0x02,
dmLimitLoX = 0x10,
dmLimitLoY = 0x20,
dmLimitHiX = 0x40,
dmLimitHiY = 0x80,
dmLimitAll = dmLimitLoX | dmLimitLoY | dmLimitHiX | dmLimitHiY,
// TView Help context codes
hcNoContext = 0,
hcDragging = 1,
// TScrollBar part codes
sbLeftArrow = 0,
sbRightArrow = 1,
sbPageLeft = 2,
sbPageRight = 3,
sbUpArrow = 4,
sbDownArrow = 5,
sbPageUp = 6,
sbPageDown = 7,
sbIndicator = 8,
// TScrollBar options for TWindow.StandardScrollBar
sbHorizontal = 0x000,
sbVertical = 0x001,
sbHandleKeyboard = 0x002,
// TWindow Flags masks
wfMove = 0x01,
wfGrow = 0x02,
wfClose = 0x04,
wfZoom = 0x08,
// TView inhibit flags
noMenuBar = 0x0001,
noDeskTop = 0x0002,
noStatusLine = 0x0004,
noBackground = 0x0008,
noFrame = 0x0010,
noViewer = 0x0020,
noHistory = 0x0040,
// TWindow number constants
wnNoNumber = 0,
// TWindow palette entries
wpBlueWindow = 0,
wpCyanWindow = 1,
wpGrayWindow = 2,
// Application command codes
cmCut = 20,
cmCopy = 21,
cmPaste = 22,
cmUndo = 23,
cmClear = 24,
cmTile = 25,
cmCascade = 26,
// Standard messages
cmReceivedFocus = 50,
cmReleasedFocus = 51,
cmCommandSetChanged = 52,
// TScrollBar messages
cmScrollBarChanged = 53,
cmScrollBarClicked = 54,
// TWindow select messages
cmSelectWindowNum = 55,
// TListViewer messages
cmListItemSelected = 56,
// Event masks
positionalEvents = evMouse,
focusedEvents = evKeyboard | evCommand;
#endif // __COMMAND_CODES
#if defined( Uses_TCommandSet ) && !defined( __TCommandSet )
#define __TCommandSet
class TCommandSet
{
public:
TCommandSet();
TCommandSet( const TCommandSet& );
Boolean has( int cmd );
void disableCmd( int cmd );
void enableCmd( int cmd );
void operator += ( int cmd );
void operator -= ( int cmd );
void disableCmd( const TCommandSet& );
void enableCmd( const TCommandSet& );
void operator += ( const TCommandSet& );
void operator -= ( const TCommandSet& );
Boolean TCommandSet::isEmpty();
TCommandSet& operator &= ( const TCommandSet& );
TCommandSet& operator |= ( const TCommandSet& );
friend TCommandSet operator & ( const TCommandSet&, const TCommandSet& );
friend TCommandSet operator | ( const TCommandSet&, const TCommandSet& );
friend int operator == ( const TCommandSet& tc1, const TCommandSet& tc2 );
friend int operator != ( const TCommandSet& tc1, const TCommandSet& tc2 );
private:
int loc( int );
int mask( int );
static int near masks[8];
uchar cmds[32];
};
inline void TCommandSet::operator += ( int cmd )
{
enableCmd( cmd );
}
inline void TCommandSet::operator -= ( int cmd )
{
disableCmd( cmd );
}
inline void TCommandSet::operator += ( const TCommandSet& tc )
{
enableCmd( tc );
}
inline void TCommandSet::operator -= ( const TCommandSet& tc )
{
disableCmd( tc );
}
inline int operator != ( const TCommandSet& tc1, const TCommandSet& tc2 )
{
return !operator == ( tc1, tc2 );
}
inline int TCommandSet::loc( int cmd )
{
return cmd / 8;
}
inline int TCommandSet::mask( int cmd )
{
return masks[ cmd & 0x07 ];
}
#endif // Uses_TCommandSet
#if defined( Uses_TPalette ) && !defined( __TPalette )
#define __TPalette
class TPalette
{
public:
TPalette( const char *, ushort );
TPalette( const TPalette& );
~TPalette();
TPalette& operator = ( const TPalette& );
char& operator[]( int ) const;
char *data;
};
#endif // Uses_TPalette
#if defined( Uses_TView ) && !defined( __TView )
#define __TView
struct write_args
{
void far *self;
void far *target;
void far *buf;
ushort offset;
};
class far TRect;
class far TEvent;
class far TGroup;
class TView : public TObject, public TStreamable
{
public:
friend void genRefs();
enum phaseType { phFocused, phPreProcess, phPostProcess };
enum selectMode{ normalSelect, enterSelect, leaveSelect };
TView( const TRect& bounds );
~TView();
virtual void sizeLimits( TPoint& min, TPoint& max );
TRect getBounds();
TRect getExtent();
TRect getClipRect();
Boolean mouseInView( TPoint mouse );
Boolean containsMouse( TEvent& event );
void locate( TRect& bounds );
virtual void dragView( TEvent& event, uchar mode, // temporary fix
TRect& limits, TPoint minSize, TPoint maxSize ); // for Miller's stuff
virtual void calcBounds( TRect& bounds, TPoint delta );
virtual void changeBounds( const TRect& bounds );
void growTo( short x, short y );
void moveTo( short x, short y );
void setBounds( const TRect& bounds );
virtual ushort getHelpCtx();
virtual Boolean valid( ushort command );
void hide();
void show();
virtual void draw();
void drawView();
Boolean exposed();
void hideCursor();
void drawHide( TView *lastView );
void drawShow( TView *lastView );
void drawUnderRect( TRect& r, TView *lastView );
void drawUnderView( Boolean doShadow